gridview: Compute right amount of items to skip
authorBenjamin Otte <otte@redhat.com>
Sat, 20 Jun 2020 16:08:46 +0000 (12:08 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 20 Jun 2020 16:08:46 +0000 (12:08 -0400)
We only want to skip the remaining items in the current row, not since
the start of the widget.

gtk/gtkgridview.c

index 5531b5c53c4436fb7bcb92ef266e139518605fc8..b9c2c9a87ce2bc45d4972f2d222626a02b8c3fcf 100644 (file)
@@ -269,7 +269,8 @@ gtk_grid_view_get_cell_at_y (GtkGridView *self,
       /* skip remaining items at end of row */
       if (pos % self->n_columns)
         {
-          skip = pos - pos % self->n_columns;
+          skip = self->n_columns - pos % self->n_columns;
+          g_assert (n_items > skip);
           n_items -= skip;
           pos += skip;
         }